package com.xjiye_test.payServer.servletGroup.weixinpublic;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by Administrator on 2017/5/19.
 */
public class Message extends HttpServlet {
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("UTF-8");
        PrintWriter out = resp.getWriter();
        if(null!=req.getParameter("reset")){
            count.reset();
        }else {
            count.add();
            System.out.println("==收到客户消息次数："+count.getCount());
            req.setCharacterEncoding("UTF-8");
            out.println("{\"errcode\":0,\"errmsg\":\"ok\"}");
            out.flush();
        }
    }

    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }
}
